package com.feriki.msync.config;

import com.feriki.msync.constants.ConnectType;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @author luozhida
 * @create 2024-07-03
 */
@Data
public class ConnectConfig extends ComplexConnectConfig {
    //支持milvus、jsonl和clickhouse,默认milvus
    private String type = ConnectType.MILVUS;

    public String getType(){
        return type.toUpperCase();
    }

    public void setType(String type){
        if(StringUtils.isBlank(type)){
            this.type =  ConnectType.MILVUS;
            return;
        }
        if(!ConnectType.SUPPORT_LIST.contains(type.toUpperCase())){
            throw new IllegalArgumentException("不合法的type,仅支持"+ConnectType.SUPPORT_LIST);
        }
        this.type = type.toUpperCase();;
    }
}
